#include <stdio.h>


int main()
{
	int num;
	scanf("%d",&num);
	int g,s,b;
	g=num%10;
	s=num%100/10;
	b=num%1000/100;
	int ret=(g*g*g)+(s*s*s)+(b*b*b);
	if(ret==num)
	printf("1");
	else
	printf("0");
	return 0;
}